package com.commpany.servie.basic.order.converter;

import java.util.ArrayList;
import java.util.List;
import java.lang.reflect.Field;
import com.commpany.servie.basic.order.model.dto.userorder.UserOrderDTO;
import com.commpany.servie.basic.order.po.UserOrderPO;

/**
 * DTO和PO相互转换工具类
 * 
 * @author test
 * @date 2020-01-02 18:31:12
 */
public class UserOrderConverter {
	
	public static UserOrderDTO toDTO(UserOrderPO src) {
	if(src==null) return null;
		UserOrderDTO  tar = new UserOrderDTO();
		tar.setId(src.getId());
		tar.setUserId(src.getUserId());
		tar.setProductId(src.getProductId());
		tar.setOrderNo(src.getOrderNo());
		return tar;
	}

	public static UserOrderPO toPO(UserOrderDTO src) {
	if(src==null) return null;
		UserOrderPO  tar = new UserOrderPO();
		tar.setId(src.getId());
		tar.setUserId(src.getUserId());
		tar.setProductId(src.getProductId());
		tar.setOrderNo(src.getOrderNo());
		return tar;
	}

	public static List<UserOrderDTO> toDTO(List<UserOrderPO> srcs) {
		if (srcs == null)
			return null;
		List<UserOrderDTO> list = new ArrayList<UserOrderDTO>();
		for (UserOrderPO src : srcs) {
			list.add(toDTO(src));
		}
		return list;
	}

	public static List<UserOrderPO> toPO(List<UserOrderDTO> srcs) {
		if (srcs == null)
			return null;
		List<UserOrderPO> list = new ArrayList<UserOrderPO>();
		for (UserOrderDTO src : srcs) {
			list.add(toPO(src));
		}
		return list;
	}
}
	